__author__ = 'lliugh'
# -*- coding: utf-8 -*-

# 读写2003 excel
# pip install xlrd
# pip install xlwt
import xlrd

# 读写2007 excel
# pip install openpyxl
import openpyxl


file_2003 = '/Users/liuguohao/workspace/python/data/2003.xls'
file_2007 = '/Users/liuguohao/workspace/python/data/2007.xlsx'

def read03Excel(path):
    workbook = xlrd.open_workbook(path)
    sheets = workbook.sheet_names()
    worksheet = workbook.sheet_by_name(sheets[0])
    for i in range(0, worksheet.nrows):
        for j in range(0, worksheet.ncols):
            print(worksheet.cell_value(i, j), "\t", end="")
        print()


def read07Excel(path):
    wb = openpyxl.load_workbook(path)
    sheet = wb['2007测试表']

    for row in sheet.rows:
        for cell in row:
            print(cell.value, "\t", end="")
        print()



read03Excel(file_2003)

read07Excel(file_2007)